In this How To we are going to build ncdu 1.10 with our GCC/G++ 4.8.2 cross-compiler. Be sure to start this build in a new terminal/tab to avoid any pollution from previous builds.
Ncdu rocks, full-stop. As I have mentioned before in my previous wiki page(s), I'm a big advocate of the Linux CLI, Command Line Interface ;o), and ncdu is another reason why I enjoy using it. Don't just take my word for it, try it out yourself!
Tar Balls
Here is a list of source packages that we'll need for the build. You can either download them now or wait 'til later in the How To.
ncdu-1.10.tar.gz
As you already figured out, you'll need Ncurses for this build.
Create a Workspace
I recommend creating a workspace under your /home/<your user>/ directory that is dedicated to this build. So let's fire up your terminal and run the following:
NOTE: Depending on whether you are using a cross-compiler built from my other wikis you might need to change INSTALLDIR to point to your cross-compiler.
Build Ncdu
$ cd ../build/
!!! Need to perform some hacks !!!
open ../ncdu-1.10/configure NOTE: Keep this file open during the build and re-save if necessary
on line 4520, change:
for ac_header in limits.h sys/time.h sys/types.h sys/stat.h dirent.h unistd.h fnmatch.h ncurses.h locale.h
to:
for ac_header in limits.h sys/time.h sys/types.h sys/stat.h dirent.h unistd.h fnmatch.h locale.h
!!! End of hack !!!
$ ../src/ncdu-1.10/./configure --prefix=/home/<your user>/workbench/ncdu/final --host=$TARGETMACH --build=$BUILDMACH
$ make LDFLAGS+=-L/home/<your user>/workbench/ncurses/final/lib CPPFLAGS+=-I/home/<your user>/workbench/ncurses/final/include
$ make install
NOTE: *I* had to do the above hack to get ncdu to cross-compile on my machine. You might not have to; first try the build without the above hack and if does not work then try my workaround (above).
Output
cd into the final directory and output its contents:
$ cd ../final/
$ ls
You should have the following directories:
bin
share
Make sure the binaries are for ARM:
$ cd bin/
$ file ncdu
bash: ELF 32-bit LSB executable, ARM, version 1 (SYSV), dynamically linked (uses shared libs), for GNU/Linux 2.6.16, not stripped
If you see something similar to above you're good to go ;-)
Lastly, move the contents of these directories, or the directories themselves if they do not already exist, to your custom Linux file system or dev board. For ncdu, the files should go under /usr.
Usage
Usage is very simple:
$ ncdu
Use the arrow keys on your keyboard to navigate and press the esc key to exit. RTFM ;o)
Lastly, If you get an error message like: "Error: cannot open vt102.", then you'll need to set the TERMINFO environment variable, ex:
$ export TERMINFO=/usr/share/terminfo
If you are using a common Linux distro, then this should already be taken care of. But if you are making your own Linux minimal file system then you will need to do this.
How To Build NCurses Disk Usage for ARM
Intro
In this How To we are going to build ncdu 1.10 with our GCC/G++ 4.8.2 cross-compiler. Be sure to start this build in a new terminal/tab to avoid any pollution from previous builds.
Ncdu rocks, full-stop. As I have mentioned before in my previous wiki page(s), I'm a big advocate of the Linux CLI, Command Line Interface ;o), and ncdu is another reason why I enjoy using it. Don't just take my word for it, try it out yourself!
Tar Balls
Here is a list of source packages that we'll need for the build. You can either download them now or wait 'til later in the How To.
As you already figured out, you'll need Ncurses for this build.
Create a Workspace
I recommend creating a workspace under your /home/<your user>/ directory that is dedicated to this build. So let's fire up your terminal and run the following:
Gather the Sources
Now that we have a workspace created and we are currently in the src directory we can begin bringing down the sources and extracting them.
ncdu
Build Environment
To make things a little smoother let's setup some environment variables:
$ export INSTALLDIR=~/workbench/gcc-g++-4.8.2/arm $ export PATH=$INSTALLDIR/bin:$PATH $ export TARGETMACH=arm-none-linux-gnueabi $ export BUILDMACH=i686-pc-linux-gnu $ export CROSS=arm-none-linux-gnueabi $ export CC=${CROSS}-gcc $ export LD=${CROSS}-ld $ export AS=${CROSS}-as $ export CXX=${CROSS}-g++NOTE: Depending on whether you are using a cross-compiler built from my other wikis you might need to change INSTALLDIR to point to your cross-compiler.Build Ncdu
NOTE: *I* had to do the above hack to get ncdu to cross-compile on my machine. You might not have to; first try the build without the above hack and if does not work then try my workaround (above).
Output
cd into the final directory and output its contents:
You should have the following directories:
Make sure the binaries are for ARM:
If you see something similar to above you're good to go ;-)
Lastly, move the contents of these directories, or the directories themselves if they do not already exist, to your custom Linux file system or dev board. For ncdu, the files should go under /usr.
Usage
Usage is very simple:
Use the arrow keys on your keyboard to navigate and press the esc key to exit. RTFM ;o)
Lastly, If you get an error message like: "Error: cannot open vt102.", then you'll need to set the TERMINFO environment variable, ex:
If you are using a common Linux distro, then this should already be taken care of. But if you are making your own Linux minimal file system then you will need to do this.